﻿@model S4Store.Models.FinancialReport.FWXSLModel
@{
    ViewBag.Title = "FWXSL";
    Layout = null;
    
    S4Store.Models.Chart.Column ChartModel = new S4Store.Models.Chart.Column();
    ChartModel.Name = "各车型服务吸收率对比";
    ChartModel.YAxis = "天数";

    ChartModel.XAxis.Add("公司总计");       
    foreach(var report in Model.Reports){
        ChartModel.XAxis.Add(report.CarBrand.Name);       
    }
    
    S4Store.Models.Chart.ChartSeries series = new S4Store.Models.Chart.ChartSeries();
    series.Name = "目标服务吸收率";
    series.Data.Add(Model.StoreReport.FWXSLVTarget);
    foreach (var report in Model.Reports)
    {
        series.Data.Add(report.FWXSLVTarget);
    }
    ChartModel.Serieses.Add(series);

    series = new S4Store.Models.Chart.ChartSeries();
    series.Name = "实际服务吸收率";
    series.Data.Add(Model.StoreReport.FWXSLV);
    foreach (var report in Model.Reports)
    {
        series.Data.Add(report.FWXSLV);
    }
    ChartModel.Serieses.Add(series);

    List<S4Store.Models.Chart.RedGreenIndex> RedGreenIndexs = new List<S4Store.Models.Chart.RedGreenIndex>();

    S4Store.Models.Chart.RedGreenIndex index0 = new S4Store.Models.Chart.RedGreenIndex();
    index0.Size = S4Store.Models.Chart.RedGreenIndex.IndexSize.Big;
    index0.Value = Model.StoreReport.FWXSLVDiff.toInt()+"%";
    index0.Title = "实际服务吸收率与服务吸收率目标的差异";
    if (Model.StoreReport.FWXSLVDiff >= 0)
    {
        index0.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Green;
    }
    else
    {
        index0.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Red;
    }
    RedGreenIndexs.Add(index0);
    
    foreach (var report in Model.Reports)
    {
        S4Store.Models.Chart.RedGreenIndex index = new S4Store.Models.Chart.RedGreenIndex();
        index.Size = S4Store.Models.Chart.RedGreenIndex.IndexSize.Big;
        index.Value = report.FWXSLVDiff.toInt() + "%";
        index.Title = "实际服务吸收率与服务吸收率目标的差异";
        if (report.FWXSLVDiff >= 0)
        {
            index.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Green;   
        }else{
            index.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Red;   
        }
        RedGreenIndexs.Add(index);
    }
}
<div style="height:100%; overflow:auto">
@Html.Action("ReportBar", "Common", Model.BarModel)
<div style="position:relative; width:100%">
      
        @Html.Partial("../Chart/Column", ChartModel)
        @Html.Partial("../Chart/RedGreenIndex", RedGreenIndexs)
    
</div>
</div>


